home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / DatabaseAccess.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  12.8 KB  |  464 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DatabaseAccess.a
  3. ;
  4. ;    Contains:    Database Access Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1989-1998, 1995-1997 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__DATABASEACCESS__') = 'UNDEFINED' THEN
  18. __DATABASEACCESS__ SET 1
  19.  
  20.     IF &TYPE('__RESOURCES__') = 'UNDEFINED' THEN
  21.     include 'Resources.a'
  22.     ENDIF
  23.  
  24. ;  data type codes 
  25.  
  26. typeNone                        EQU        'none'
  27. typeDate                        EQU        'date'
  28. typeTime                        EQU        'time'
  29. typeTimeStamp                    EQU        'tims'
  30. typeDecimal                        EQU        'deci'
  31. typeMoney                        EQU        'mone'
  32. typeVChar                        EQU        'vcha'
  33. typeVBin                        EQU        'vbin'
  34. typeLChar                        EQU        'lcha'
  35. typeLBin                        EQU        'lbin'
  36. typeDiscard                        EQU        'disc'                ; "dummy" types for DBResultsToText 
  37. typeUnknown                        EQU        'unkn'
  38. typeColBreak                    EQU        'colb'
  39. typeRowBreak                    EQU        'rowb'                ; pass this in to DBGetItem for any data type 
  40. typeAnyType                        EQU        0
  41. ;  infinite timeout value for DBGetItem 
  42.  
  43.                                                             ; messages for status functions for DBStartQuery 
  44. kDBUpdateWind                    EQU        0
  45. kDBAboutToInit                    EQU        1
  46. kDBInitComplete                    EQU        2
  47. kDBSendComplete                    EQU        3
  48. kDBExecComplete                    EQU        4
  49. kDBStartQueryComplete            EQU        5
  50.  
  51.                                                             ; messages for status functions for DBGetQueryResults 
  52. kDBGetItemComplete                EQU        6
  53. kDBGetQueryResultsComplete        EQU        7
  54. kDBWaitForever                    EQU        -1
  55.  
  56.                                                             ;  flags for DBGetItem  
  57. kDBLastColFlag                    EQU        $0001
  58. kDBNullFlag                        EQU        $0004
  59. ; typedef OSType                         DBType
  60.  
  61.  
  62.  
  63. ; typedef DBAsyncParamBlockRec *        DBAsyncParmBlkPtr
  64.  
  65. ;  structure for asynchronous parameter block 
  66. DBAsyncParamBlockRec    RECORD 0
  67. completionProc             ds.l    1                ; offset: $0 (0)        ;  pointer to completion routine 
  68. result                     ds.w    1                ; offset: $4 (4)        ;  result of call 
  69. userRef                     ds.l    1                ; offset: $6 (6)        ;  for application's use 
  70. ddevRef                     ds.l    1                ; offset: $A (10)        ;  for ddev's use 
  71. reserved                 ds.l    1                ; offset: $E (14)        ;  for internal use 
  72. sizeof                     EQU *                    ; size:   $12 (18)
  73.                         ENDR
  74. ;  structure for resource list in QueryRecord 
  75. ResListElem                RECORD 0
  76. theType                     ds.l    1                ; offset: $0 (0)        ;  resource type 
  77. id                         ds.w    1                ; offset: $4 (4)        ;  resource id 
  78. sizeof                     EQU *                    ; size:   $6 (6)
  79.                         ENDR
  80. ; typedef struct ResListElem *            ResListPtr
  81.  
  82. ; typedef ResListPtr *                    ResListHandle
  83.  
  84. ;  structure for query list in QueryRecord 
  85. QueryArray                RECORD 0
  86. elements                 ds.l    256
  87. sizeof                     EQU *                    ; size:   $400 (1024)
  88.                         ENDR
  89.  
  90.  
  91. QueryRecord                RECORD 0
  92. version                     ds.w    1                ; offset: $0 (0)        ;  version 
  93. id                         ds.w    1                ; offset: $2 (2)        ;  id of 'qrsc' this came from 
  94. queryProc                 ds.l    1                ; offset: $4 (4)        ;  handle to query def proc 
  95. ddevName                 ds        Str63            ; offset: $8 (8)        ;  ddev name 
  96. host                     ds        Str255            ; offset: $48 (72)        ;  host name 
  97. user                     ds        Str255            ; offset: $148 (328)    ;  user name 
  98. password                 ds        Str255            ; offset: $248 (584)    ;  password 
  99. connStr                     ds        Str255            ; offset: $348 (840)    ;  connection string 
  100. currQuery                 ds.w    1                ; offset: $448 (1096)    ;  index of current query 
  101. numQueries                 ds.w    1                ; offset: $44A (1098)    ;  number of queries in list 
  102. queryList                 ds.l    1                ; offset: $44C (1100)    ;  handle to array of handles to text 
  103. numRes                     ds.w    1                ; offset: $450 (1104)    ;  number of resources in list 
  104. resList                     ds.l    1                ; offset: $452 (1106)    ;  handle to array of resource list elements 
  105. dataHandle                 ds.l    1                ; offset: $456 (1110)    ;  for use by query def proc 
  106. refCon                     ds.l    1                ; offset: $45A (1114)    ;  for use by application 
  107. sizeof                     EQU *                    ; size:   $45E (1118)
  108.                         ENDR
  109. ; typedef struct QueryRecord *            QueryPtr
  110.  
  111. ; typedef QueryPtr *                    QueryHandle
  112.  
  113. ;  structure of column types array in ResultsRecord 
  114. ColTypesArray            RECORD 0
  115. elements                 ds.l    256
  116. sizeof                     EQU *                    ; size:   $400 (1024)
  117.                         ENDR
  118.  
  119.  
  120. ;  structure for column info in ResultsRecord 
  121. DBColInfoRecord            RECORD 0
  122. len                         ds.w    1                ; offset: $0 (0)
  123. places                     ds.w    1                ; offset: $2 (2)
  124. flags                     ds.w    1                ; offset: $4 (4)
  125. sizeof                     EQU *                    ; size:   $6 (6)
  126.                         ENDR
  127. ColInfoArray            RECORD 0
  128. elements                 ds.b    256 * DBColInfoRecord.sizeof
  129. sizeof                     EQU *                    ; size:   $600 (1536)
  130.                         ENDR
  131.  
  132.  
  133. ;  structure of results returned by DBGetResults 
  134. ResultsRecord            RECORD 0
  135. numRows                     ds.w    1                ; offset: $0 (0)        ;  number of rows in result 
  136. numCols                     ds.w    1                ; offset: $2 (2)        ;  number of columns per row 
  137. colTypes                 ds.l    1                ; offset: $4 (4)        ;  data type array 
  138. colData                     ds.l    1                ; offset: $8 (8)        ;  actual results 
  139. colInfo                     ds.l    1                ; offset: $C (12)        ;  DBColInfoRecord array 
  140. sizeof                     EQU *                    ; size:   $10 (16)
  141.                         ENDR
  142.  
  143.                                                             ; messages sent to a 'ddev'
  144. kDBInit                            EQU        0
  145. kDBEnd                            EQU        1
  146. kDBGetConnInfo                    EQU        2
  147. kDBGetSessionNum                EQU        3
  148. kDBSend                            EQU        4
  149. kDBSendItem                        EQU        5
  150. kDBExec                            EQU        6
  151. kDBState                        EQU        7
  152. kDBGetErr                        EQU        8
  153. kDBBreak                        EQU        9
  154. kDBGetItem                        EQU        10
  155. kDBUngetItem                    EQU        11
  156. kDBKill                            EQU        12
  157. kDBOpen                            EQU        100
  158. kDBClose                        EQU        101
  159. kDBIdle                            EQU        102
  160. ;
  161. ; pascal OSErr InitDBPack(void )
  162. ;
  163.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  164.         Macro
  165.         _InitDBPack
  166.             move.w              #$0004,-(sp)
  167.             move.w              #$0100,D0
  168.             dc.w                $A82F
  169.         EndM
  170.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  171.         IMPORT_CFM_FUNCTION InitDBPack
  172.     ENDIF
  173.  
  174. ;
  175. ; pascal OSErr DBInit(long *sessID, ConstStr63Param ddevName, ConstStr255Param host, ConstStr255Param user, ConstStr255Param passwd, ConstStr255Param connStr, DBAsyncParmBlkPtr asyncPB)
  176. ;
  177.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  178.         Macro
  179.         _DBInit
  180.             move.w              #$0E02,D0
  181.             dc.w                $A82F
  182.         EndM
  183.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  184.         IMPORT_CFM_FUNCTION DBInit
  185.     ENDIF
  186.  
  187. ;
  188. ; pascal OSErr DBEnd(long sessID, DBAsyncParmBlkPtr asyncPB)
  189. ;
  190.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  191.         Macro
  192.         _DBEnd
  193.             move.w              #$0403,D0
  194.             dc.w                $A82F
  195.         EndM
  196.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  197.         IMPORT_CFM_FUNCTION DBEnd
  198.     ENDIF
  199.  
  200. ;
  201. ; pascal OSErr DBGetConnInfo(long sessID, short sessNum, long *returnedID, long *version, Str63 ddevName, Str255 host, Str255 user, Str255 network, Str255 connStr, long *start, OSErr *state, DBAsyncParmBlkPtr asyncPB)
  202. ;
  203.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  204.         Macro
  205.         _DBGetConnInfo
  206.             move.w              #$1704,D0
  207.             dc.w                $A82F
  208.         EndM
  209.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  210.         IMPORT_CFM_FUNCTION DBGetConnInfo
  211.     ENDIF
  212.  
  213. ;
  214. ; pascal OSErr DBGetSessionNum(long sessID, short *sessNum, DBAsyncParmBlkPtr asyncPB)
  215. ;
  216.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  217.         Macro
  218.         _DBGetSessionNum
  219.             move.w              #$0605,D0
  220.             dc.w                $A82F
  221.         EndM
  222.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  223.         IMPORT_CFM_FUNCTION DBGetSessionNum
  224.     ENDIF
  225.  
  226. ;
  227. ; pascal OSErr DBSend(long sessID, Ptr text, short len, DBAsyncParmBlkPtr asyncPB)
  228. ;
  229.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  230.         Macro
  231.         _DBSend
  232.             move.w              #$0706,D0
  233.             dc.w                $A82F
  234.         EndM
  235.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  236.         IMPORT_CFM_FUNCTION DBSend
  237.     ENDIF
  238.  
  239. ;
  240. ; pascal OSErr DBSendItem(long sessID, DBType dataType, short len, short places, short flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  241. ;
  242.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  243.         Macro
  244.         _DBSendItem
  245.             move.w              #$0B07,D0
  246.             dc.w                $A82F
  247.         EndM
  248.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  249.         IMPORT_CFM_FUNCTION DBSendItem
  250.     ENDIF
  251.  
  252. ;
  253. ; pascal OSErr DBExec(long sessID, DBAsyncParmBlkPtr asyncPB)
  254. ;
  255.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  256.         Macro
  257.         _DBExec
  258.             move.w              #$0408,D0
  259.             dc.w                $A82F
  260.         EndM
  261.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  262.         IMPORT_CFM_FUNCTION DBExec
  263.     ENDIF
  264.  
  265. ;
  266. ; pascal OSErr DBState(long sessID, DBAsyncParmBlkPtr asyncPB)
  267. ;
  268.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  269.         Macro
  270.         _DBState
  271.             move.w              #$0409,D0
  272.             dc.w                $A82F
  273.         EndM
  274.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  275.         IMPORT_CFM_FUNCTION DBState
  276.     ENDIF
  277.  
  278. ;
  279. ; pascal OSErr DBGetErr(long sessID, long *err1, long *err2, Str255 item1, Str255 item2, Str255 errorMsg, DBAsyncParmBlkPtr asyncPB)
  280. ;
  281.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  282.         Macro
  283.         _DBGetErr
  284.             move.w              #$0E0A,D0
  285.             dc.w                $A82F
  286.         EndM
  287.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  288.         IMPORT_CFM_FUNCTION DBGetErr
  289.     ENDIF
  290.  
  291. ;
  292. ; pascal OSErr DBBreak(long sessID, Boolean abort, DBAsyncParmBlkPtr asyncPB)
  293. ;
  294.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  295.         Macro
  296.         _DBBreak
  297.             move.w              #$050B,D0
  298.             dc.w                $A82F
  299.         EndM
  300.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  301.         IMPORT_CFM_FUNCTION DBBreak
  302.     ENDIF
  303.  
  304. ;
  305. ; pascal OSErr DBGetItem(long sessID, long timeout, DBType *dataType, short *len, short *places, short *flags, void *buffer, DBAsyncParmBlkPtr asyncPB)
  306. ;
  307.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  308.         Macro
  309.         _DBGetItem
  310.             move.w              #$100C,D0
  311.             dc.w                $A82F
  312.         EndM
  313.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  314.         IMPORT_CFM_FUNCTION DBGetItem
  315.     ENDIF
  316.  
  317. ;
  318. ; pascal OSErr DBUnGetItem(long sessID, DBAsyncParmBlkPtr asyncPB)
  319. ;
  320.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  321.         Macro
  322.         _DBUnGetItem
  323.             move.w              #$040D,D0
  324.             dc.w                $A82F
  325.         EndM
  326.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  327.         IMPORT_CFM_FUNCTION DBUnGetItem
  328.     ENDIF
  329.  
  330. ;
  331. ; pascal OSErr DBKill(DBAsyncParmBlkPtr asyncPB)
  332. ;
  333.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  334.         Macro
  335.         _DBKill
  336.             move.w              #$020E,D0
  337.             dc.w                $A82F
  338.         EndM
  339.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  340.         IMPORT_CFM_FUNCTION DBKill
  341.     ENDIF
  342.  
  343. ;
  344. ; pascal OSErr DBGetNewQuery(short queryID, QueryHandle *query)
  345. ;
  346.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  347.         Macro
  348.         _DBGetNewQuery
  349.             move.w              #$030F,D0
  350.             dc.w                $A82F
  351.         EndM
  352.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  353.         IMPORT_CFM_FUNCTION DBGetNewQuery
  354.     ENDIF
  355.  
  356. ;
  357. ; pascal OSErr DBDisposeQuery(QueryHandle query)
  358. ;
  359.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  360.         Macro
  361.         _DBDisposeQuery
  362.             move.w              #$0210,D0
  363.             dc.w                $A82F
  364.         EndM
  365.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  366.         IMPORT_CFM_FUNCTION DBDisposeQuery
  367.     ENDIF
  368.  
  369. ;
  370. ; pascal OSErr DBStartQuery(long *sessID, QueryHandle query, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  371. ;
  372.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  373.         Macro
  374.         _DBStartQuery
  375.             move.w              #$0811,D0
  376.             dc.w                $A82F
  377.         EndM
  378.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  379.         IMPORT_CFM_FUNCTION DBStartQuery
  380.     ENDIF
  381.  
  382. ;
  383. ; pascal OSErr DBGetQueryResults(long sessID, ResultsRecord *results, long timeout, DBStatusUPP statusProc, DBAsyncParmBlkPtr asyncPB)
  384. ;
  385.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  386.         Macro
  387.         _DBGetQueryResults
  388.             move.w              #$0A12,D0
  389.             dc.w                $A82F
  390.         EndM
  391.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  392.         IMPORT_CFM_FUNCTION DBGetQueryResults
  393.     ENDIF
  394.  
  395. ;
  396. ; pascal OSErr DBResultsToText(ResultsRecord *results, Handle *theText)
  397. ;
  398.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  399.         Macro
  400.         _DBResultsToText
  401.             move.w              #$0413,D0
  402.             dc.w                $A82F
  403.         EndM
  404.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  405.         IMPORT_CFM_FUNCTION DBResultsToText
  406.     ENDIF
  407.  
  408. ;
  409. ; pascal OSErr DBInstallResultHandler(DBType dataType, DBResultHandlerUPP theHandler, Boolean isSysHandler)
  410. ;
  411.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  412.         Macro
  413.         _DBInstallResultHandler
  414.             move.w              #$0514,D0
  415.             dc.w                $A82F
  416.         EndM
  417.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  418.         IMPORT_CFM_FUNCTION DBInstallResultHandler
  419.     ENDIF
  420.  
  421. ;
  422. ; pascal OSErr DBRemoveResultHandler(DBType dataType)
  423. ;
  424.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  425.         Macro
  426.         _DBRemoveResultHandler
  427.             move.w              #$0215,D0
  428.             dc.w                $A82F
  429.         EndM
  430.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  431.         IMPORT_CFM_FUNCTION DBRemoveResultHandler
  432.     ENDIF
  433.  
  434. ;
  435. ; pascal OSErr DBGetResultHandler(DBType dataType, DBResultHandlerUPP *theHandler, Boolean getSysHandler)
  436. ;
  437.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  438.         Macro
  439.         _DBGetResultHandler
  440.             move.w              #$0516,D0
  441.             dc.w                $A82F
  442.         EndM
  443.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  444.         IMPORT_CFM_FUNCTION DBGetResultHandler
  445.     ENDIF
  446.  
  447. ;
  448. ; pascal OSErr DBIdle(void )
  449. ;
  450.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  451.         Macro
  452.         _DBIdle
  453.             move.w              #$00FF,D0
  454.             dc.w                $A82F
  455.         EndM
  456.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  457.         IMPORT_CFM_FUNCTION DBIdle
  458.     ENDIF
  459.  
  460.  
  461.  
  462.     ENDIF ; __DATABASEACCESS__ 
  463.  
  464.